<link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
<div class="contentArea">
    <div class="Item hr">
        <div class="current">用户协议</div>>
    </div>
    <form>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table1">
            <textarea class="layui-textarea" id="LAY_demo1" style="display: none">
                    {$agreement}
            </textarea>

        </table>
    </form>
    <div class="commonBtnArea">
        <button class="btn submit">提交</button>
    </div>
</div>

<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>

<script>
    layui.use('layedit', function(){
        var layedit = layui.layedit
            ,$ = layui.jquery;

        //构建一个默认的编辑器
        var index = layedit.build('LAY_demo1');


        //编辑器外部操作
        $('.commonBtnArea').click(function(){

            agreement = layedit.getContent(index);

            $.post("{:U('Config/edit_agreement')}",{agreement:agreement},function(data){
                if(data.code == 0){
                    layer.msg(data.message,{icon:1,time: 1000});
                }else{
                    layer.alert(data.message,{icon:2});
                }
            },'json')
        })



    });


</script>
